
<template>
  <div>
    <h1>Provide() 和 inject()</h1>
    <input type="button" value="修改歌手" @click="changeSinger">
    <Son ></Son>
  </div>
</template>

<script setup>
import {provide,inject, reactive} from "vue";
import Son from "./Son.vue";

let musiceReactive = reactive({name:"分手快乐",singer:"张三疯"});
provide("music",musiceReactive);


function changeSinger(){
  musiceReactive.singer = "梅超风";
}


</script>

<style scoped>

</style>